import 'package:tender_flutter/page/home/model/credit_entity.dart';

creditEntityFromJson(CreditEntity data, Map<String, dynamic> json) {
	if (json['pageNumber'] != null) {
		data.pageNumber = json['pageNumber'] is String
				? int.tryParse(json['pageNumber'])
				: json['pageNumber'].toInt();
	}
	if (json['pageSize'] != null) {
		data.pageSize = json['pageSize'] is String
				? int.tryParse(json['pageSize'])
				: json['pageSize'].toInt();
	}
	if (json['offset'] != null) {
		data.offset = json['offset'] is String
				? int.tryParse(json['offset'])
				: json['offset'].toInt();
	}
	if (json['paged'] != null) {
		data.paged = json['paged'] is String
				? int.tryParse(json['paged'])
				: json['paged'].toInt();
	}
	if (json['content'] != null) {
		data.content = new List<CreditList>();
		(json['content'] as List).forEach((v) {
			data.content.add(new CreditList().fromJson(v));
		});
	}
	return data;
}

Map<String, dynamic> creditEntityToJson(CreditEntity entity) {
	final Map<String, dynamic> data = new Map<String, dynamic>();
	data['pageNumber'] = entity.pageNumber;
	data['pageSize'] = entity.pageSize;
	data['offset'] = entity.offset;
	data['paged'] = entity.paged;
	if (entity.content != null) {
		data['content'] =  entity.content.map((v) => v.toJson()).toList();
	}
	return data;
}

creditListFromJson(CreditList data, Map<String, dynamic> json) {
	if (json['caseCode'] != null) {
		data.caseCode = json['caseCode'].toString();
	}
	if (json['gistUnit'] != null) {
		data.gistUnit = json['gistUnit'].toString();
	}
	if (json['publishDate'] != null) {
		data.publishDate = json['publishDate'].toString();
	}
	if (json['regDate'] != null) {
		data.regDate = json['regDate'].toString();
	}
	if (json['businessEntity'] != null) {
		data.businessEntity = json['businessEntity'].toString();
	}
	if (json['disruptTypeName'] != null) {
		data.disruptTypeName = json['disruptTypeName'].toString();
	}
	if (json['cardNum'] != null) {
		data.cardNum = json['cardNum'].toString();
	}
	if (json['dishonestId'] != null) {
		data.dishonestId = json['dishonestId'].toString();
	}
	if (json['performance'] != null) {
		data.performance = json['performance'].toString();
	}
	if (json['courtName'] != null) {
		data.courtName = json['courtName'].toString();
	}
	if (json['areaName'] != null) {
		data.areaName = json['areaName'].toString();
	}
	if (json['dishonestName'] != null) {
		data.dishonestName = json['dishonestName'].toString();
	}
	if (json['gistId'] != null) {
		data.gistId = json['gistId'].toString();
	}
	if (json['legalDuty'] != null) {
		data.legalDuty = json['legalDuty'].toString();
	}
	return data;
}

Map<String, dynamic> creditListToJson(CreditList entity) {
	final Map<String, dynamic> data = new Map<String, dynamic>();
	data['caseCode'] = entity.caseCode;
	data['gistUnit'] = entity.gistUnit;
	data['publishDate'] = entity.publishDate;
	data['regDate'] = entity.regDate;
	data['businessEntity'] = entity.businessEntity;
	data['disruptTypeName'] = entity.disruptTypeName;
	data['cardNum'] = entity.cardNum;
	data['dishonestId'] = entity.dishonestId;
	data['performance'] = entity.performance;
	data['courtName'] = entity.courtName;
	data['areaName'] = entity.areaName;
	data['dishonestName'] = entity.dishonestName;
	data['gistId'] = entity.gistId;
	data['legalDuty'] = entity.legalDuty;
	return data;
}